package com.atguigu.gulimall.product.feign.fallback;

import com.atguigu.common.to.SkuReductionTo;
import com.atguigu.common.to.SpuBoundsTo;
import com.atguigu.common.utils.R;
import com.atguigu.gulimall.product.feign.CouponFeignService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @create: 2024/8/25
 * @author: gyhe10
 * @description: CouponFeignService 接口的降级类
 **/

@Slf4j
@Component
public class CouponFeignServiceFallback implements CouponFeignService {
    @Override
    public R saveSpuBounds(SpuBoundsTo spuBoundsTo) {
        log.error("调用 coupon 微服务保存 SPU 积分信息失败，SPU 的 ID = {}", spuBoundsTo.getSpuId());
        return R.error("调用 coupon 微服务保存 SPU 积分信息失败");
    }

    @Override
    public R saveSkuReduction(SkuReductionTo skuReductionTo) {
        log.error("调用 coupon 微服务保存 SKU 优惠信息失败，SKU 的 ID = {}", skuReductionTo.getSkuId());
        return R.error("调用 coupon 微服务保存 SKU 优惠信息失败");
    }
}
